# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Ray Rashif <schiv@archlinux.org>

pkgbase=liblo
pkgname=(liblo liblo-docs)
pkgver=0.31
pkgrel=3
epoch=1
pkgdesc="A lightweight OSC (Open Sound Control) implementation"
arch=(loong64 x86_64)
url="http://liblo.sourceforge.net/"
license=(LGPL2.1)
makedepends=(doxygen)
source=(https://github.com/radarsat1/$pkgname/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('328d413a6608e5e99d41bfc5a153ef10510e79589cb4d8df4511c8187b8baa6fd8f8c2fd3fe54de7736855f699619d4ebc088a17acf8700085b59ee38ade7d21')
b2sums=('0dcec43175a960fbb56a0082bed64dd55dd2f40b0a1b0356222cc25ea6212109ca6626656ce6030625a3bc02b9383a8691ea163fc4e401f2c4003dbf34bc5837')

prepare() {
  cd $pkgname-$pkgver
  # fixing bug in autotools setup:
  # https://github.com/radarsat1/liblo/issues/96
  ln -svf README.md README
  autoreconf -fiv
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  make
}

package_liblo() {
  depends=(glibc)
  optdepends=(
    'liblo-docs: for documentation and examples'
  )
  provides=(liblo.so)

  make DESTDIR="$pkgdir" install -C $pkgname-$pkgver
  install -vDm 644 $pkgname-$pkgver/doc/man/man3/*.3 -t "$pkgdir/usr/share/man/man3"
}

package_liblo-docs() {
  pkgdesc+=" - documentation"

  install -vDm 644 $pkgbase-$pkgver/examples/*.{cpp,c} -t "$pkgdir/usr/share/$pkgbase/examples/"
  install -vDm 644 $pkgbase-$pkgver/doc/html/* -t "$pkgdir/usr/share/doc/$pkgbase/html/"
  install -vDm 644 $pkgbase-$pkgver/doc/latex/* -t "$pkgdir/usr/share/doc/$pkgbase/latex/"
  install -vDm 644 $pkgbase-$pkgver/{AUTHORS,ChangeLog,NEWS,README.md,TODO} -t "$pkgdir/usr/share/doc/$pkgbase/"
}
# vim:set ts=2 sw=2 et:
